import request1 from "@/utils/http/request1";

// 添加与修改的参数返回值类型
export interface TrademarkData {
  id?: number;
  logoUrl: string;
  tmName: string;
}

// 添加与修改的返回值类型
export interface TrademarkListData {
  records: TrademarkData[];
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}

export default {
  //   /admin/product/baseTrademark/remove/{id}
  // 删除BaseTrademark
  remove(id: number) {
    return request1.delete<any, null>(`/admin/product/baseTrademark/remove/${id}`);
  },

  // POST /admin/product/baseTrademark/save
  // 新增BaseTrademark

  // PUT /admin/product/baseTrademark/update
  // 修改BaseTrademark

  addOrUpdate(trademark: TrademarkData) {
    if (trademark.id) {
      return request1.put<any, null>("/admin/product/baseTrademark/update", trademark);
    } else {
      return request1.post<any, null>("/admin/product/baseTrademark/save", trademark);
    }
  },

  // GET /admin/product/baseTrademark/{page}/{limit}

  getTrademarkList(page: number, limit: number) {
    return request1.get<any, TrademarkListData>(`/admin/product/baseTrademark/${page}/${limit}`);
  },

  getList() {
    return request1.get<any, TrademarkData[]>("/admin/product/baseTrademark/getTrademarkList");
  },
};
